
%include 'C:\Users\maggi\Documents\Manuscript\Work from home\Programs\WFH.sas'; *call in the datastep codes;

**********************************************************************************************
                                        1. TABLE 1
********************************************************************************************** ;

data table1;
set wellbeing;

proc freq;
tables work_home2018c*(race22018c age_cat2018c gender2018 mart_status2018c educ2018c home2018c n_children2018c elders2018c no_animal2018c work_hours2018c)/chisq;
format work_home2018c work_home2018c. race22018c race22018c. age_cat2018c age_cat2018c. gender2018 gender2018c. mart_status2018c mart_status2018c. educ2018c educ2018c. 
home2018c home2018c. n_children2018c n_children2018c. elders2018c elders2018c. no_animal2018c no_animal2018c. work_hours2018c work_hours2018c.;
title "Categorical covariates by 4-cat WFH (table1)";
run;

proc freq;
tables work_home2018d*(race22018c age_cat2018c gender2018 mart_status2018c educ2018c home2018c n_children2018c elders2018c no_animal2018c work_hours2018c)/chisq;
format work_home2018d work_home2018d. race22018c race22018c. age_cat2018c age_cat2018c. gender2018 gender2018c. mart_status2018c mart_status2018c. educ2018c educ2018c. 
home2018c home2018c. n_children2018c n_children2018c. elders2018c elders2018c. no_animal2018c no_animal2018c. work_hours2018c work_hours2018c.;
title "Categorical covariates by 3-cat WFH (table1)";
run;

proc freq;
tables work_home2018e*(race22018c age_cat2018c gender2018 mart_status2018c educ2018c home2018c n_children2018c elders2018c no_animal2018c work_hours2018c)/chisq;
format work_home2018e work_home2018e. race22018c race22018c. age_cat2018c age_cat2018c. gender2018 gender2018c. mart_status2018c mart_status2018c. educ2018c educ2018c. 
home2018c home2018c. n_children2018c n_children2018c. elders2018c elders2018c. no_animal2018c no_animal2018c. work_hours2018c work_hours2018c.;
title "Categorical covariates by 5-cat WFH (table1)";
run;

%macro univ(outcome);
proc glm data=table1; 
class work_home2018c;
model &outcome.=work_home2018c;
means work_home2018c;
title "Continuous covariates by 4-cat WFH (table1)";
run;
%mend;

%univ(outcome=depressed2018);
%univ(outcome=physhlth2018 );
%univ(outcome=purpose2018);
%univ(outcome=w_meaning2018);
%univ(outcome=w_recognized2018);
%univ(outcome=w_team2018);
%univ(outcome=distracted2018_r);
%univ(outcome=wkfamilyconfl2018);
%univ(outcome=w_productive2018);
%univ(outcome=jobsatis2018);
run;

%macro univ(outcome);
proc glm data=table1; 
class work_home2018d;
model &outcome.=work_home2018d;
means work_home2018d;
title "Continuous covariates by 3-cat WFH (table1)";
run;
%mend;

%univ(outcome=depressed2018);
%univ(outcome=physhlth2018 );
%univ(outcome=depressed2018);
%univ(outcome=n_children2018 );
%univ(outcome=n_elders2018);
%univ(outcome=w_meaning2018);
%univ(outcome=w_recognized2018);
%univ(outcome=w_team2018);
%univ(outcome=distracted2018_r);
%univ(outcome=wkfamilyconfl2018);
%univ(outcome=w_productive2018);
%univ(outcome=jobsatis2018);
run;

%macro univ(outcome);
proc glm data=table1; 
class work_home2018e;
model &outcome.=work_home2018e;
means work_home2018e;
title "Continuous covariates by 5-cat WFH (table1)";
run;
%mend;

%univ(outcome=depressed2018);
%univ(outcome=physhlth2018 );
%univ(outcome=purpose2018);
%univ(outcome=w_meaning2018);
%univ(outcome=w_recognized2018);
%univ(outcome=w_team2018);
%univ(outcome=distracted2018_r);
%univ(outcome=wkfamilyconfl2018);
%univ(outcome=w_productive2018);
%univ(outcome=jobsatis2018);
run;

